package rules;

import stock.Company;

public class BuyRule21 extends Rule {

	private Company merval;

	public BuyRule21(Company merval) {
		this.merval = merval;
	}
	
	@Override
	public boolean matches(Company company) {
		
		boolean mervalGrowing =  (this.merval.getVariation() > 0);
		boolean companyGrowing = (company.getVariation() > 3);
		
		boolean bothGrowing = (mervalGrowing && companyGrowing);
		
		if ( bothGrowing ){
			return this.next(company);
		}
		return false;
	}

}
